package com.qidi.rabbit.demo;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 

@Component
public class HelloSender {

	@Autowired
	private AmqpTemplate rabbitTemplate;

	// 发送者
	public void send(User user) {

		System.out.println("Sender object: " + user.toString());
		this.rabbitTemplate.convertAndSend("userQueue", user);
	}
}